Skip to content

Conversation

@piyush-jaiswal
Copy link
Owner

@piyush-jaiswal piyush-jaiswal commented Oct 13, 2025

Summary by CodeRabbit

  • New Features

    • Upgraded interactive API documentation to OpenAPI/Swagger UI with dedicated UI paths.
    • Clearer, concise endpoint summaries across Auth, Category, Product, and Subcategory.
    • Visible security schemes for access and refresh tokens in the docs.
  • Documentation

    • Standardized and modernized API docs presentation for all endpoints, improving readability and navigation.
  • Chores

    • Removed legacy Swagger integration and its dependency to streamline the documentation stack.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Walkthrough

Replaces Flasgger with flask-smorest OpenAPI configuration, updates Swagger/UI settings, removes legacy Swagger docstrings, and adds decorator-based API documentation across route blueprints. Renames blueprint identifiers from lowercase to capitalized names in auth, category, product, and subcategory routes. Removes flasgger from requirements.

Changes

Cohort / File(s) Summary
OpenAPI config migration
app/__init__.py
Removed Flasgger import/config; added flask-smorest OpenAPI/Swagger UI settings including UI paths, CDN URL, and API_SPEC_OPTIONS with securitySchemes for access_token and refresh_token. Deleted legacy Swagger template block.
Route blueprints: naming + doc decorators
app/routes/auth.py, app/routes/category.py, app/routes/product.py, app/routes/subcategory.py
Renamed Blueprint identifiers from "auth/category/product/subcategory" to "Auth/Category/Product/Subcategory". Replaced inline Swagger-style docstrings with @bp.doc(...) decorators (summaries, and security where applicable). No functional logic changes.
Dependencies
requirements.txt
Removed flasgger==0.9.7.1.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

I hop through specs with tidy paws,
Brushing old Swagger into drawers.
Blueprints stand tall—names capital bright,
Docs now decorate, concise and light.
Tokens secure the burrow gate—
Smorest’s map, our API’s fate.
Thump-thump: release feels great! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly indicates replacing flasgger with flask-smorest OpenAPI documentation and directly reflects the removal of flasgger imports and addition of flask-smorest configuration across the codebase. It concisely summarizes the primary change without unnecessary detail.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/flask-smorest-swagger

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ea0a1c and 185cb3f.

📒 Files selected for processing (6)
  • app/__init__.py (1 hunks)
  • app/routes/auth.py (3 hunks)
  • app/routes/category.py (6 hunks)
  • app/routes/product.py (6 hunks)
  • app/routes/subcategory.py (6 hunks)
  • requirements.txt (0 hunks)
💤 Files with no reviewable changes (1)
  • requirements.txt
🧰 Additional context used
🧬 Code graph analysis (3)
app/routes/category.py (2)
app/schemas.py (2)
  • CategoriesOut (12-13)
  • CategoryOut (7-9)
app/models.py (1)
  • Category (74-90)
app/routes/product.py (3)
app/schemas.py (1)
  • ProductOut (66-68)
app/routes/category.py (5)
  • get (46-47)
  • get (88-89)
  • get (142-144)
  • get (155-168)
  • _get (83-84)
app/routes/subcategory.py (5)
  • get (47-48)
  • get (94-95)
  • get (159-161)
  • get (172-179)
  • _get (89-90)
app/routes/subcategory.py (2)
app/schemas.py (2)
  • SubcategoriesOut (41-42)
  • SubcategoryOut (36-38)
app/models.py (1)
  • Subcategory (93-110)
🔇 Additional comments (7)
app/__init__.py (2)

49-66: LGTM! Security schemes properly configured.

The JWT security schemes for access_token and refresh_token are correctly defined and will enable the Swagger UI authorization dialog.


44-45: No routing conflicts detected.
No @app.route("/") handlers were found and all blueprints are mounted under their own prefixes (/categories, /subcategories, etc.), so serving the Swagger UI at / won’t collide with existing routes.

app/routes/product.py (2)

23-23: Blueprint naming convention updated consistently.

The blueprint name change from "product" to "Product" aligns with the PascalCase convention adopted across all route modules in this PR.


47-50: API documentation decorators properly applied.

The @bp.doc decorators provide clear summaries for all endpoints, and security contexts are correctly specified for JWT-protected operations (access_token for Create, Update, and Delete operations).

Also applies to: 65-65, 100-100, 106-106, 146-146, 158-158

app/routes/auth.py (1)

17-17: LGTM! Authentication endpoints properly documented.

The blueprint name change and documentation decorators are correctly applied. The Refresh endpoint appropriately uses refresh_token security scheme, which matches the JWT requirement decorator and the security schemes defined in app/__init__.py.

Also applies to: 22-22, 46-46, 70-73

app/routes/category.py (1)

24-24: Category endpoints consistently documented.

The blueprint rename and decorator-based documentation are properly implemented. All JWT-protected endpoints correctly specify access_token security.

Also applies to: 44-44, 50-50, 86-86, 92-92, 128-128, 140-140, 152-152

app/routes/subcategory.py (1)

25-25: Subcategory endpoints consistently documented.

The blueprint rename and decorator-based documentation follow the same pattern as other route modules. Security contexts are correctly specified for all JWT-protected operations.

Also applies to: 45-45, 51-51, 92-92, 98-98, 145-145, 157-157, 169-169


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

@piyush-jaiswal piyush-jaiswal merged commit fa7aa2d into master Oct 13, 2025
3 checks passed
@piyush-jaiswal piyush-jaiswal deleted the feature/flask-smorest-swagger branch October 13, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants